package com.hq.ims.data.vo;

import com.hq.authority.utils.AppUtils;
import com.hq.ims.data.config.verification.VdAdd;
import com.hq.ims.data.config.verification.VdEdit;
import com.hq.ims.data.entity.CompanyServiceType;
import com.hq.ims.data.vo.auth.BaseRowAuthVo;
import com.hq.utils.util.ListUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.List;
import java.util.stream.Collectors;


/**
 * @author 蒋柏平
 * @since 20241022
 */
@Mapper
public interface CompanyServiceTypeMapstruct {

    CompanyServiceTypeMapstruct INSTANCE = Mappers.getMapper(CompanyServiceTypeMapstruct.class);

    //-------------------------------- 转换VO类 --------------------------------

    @Mappings({
    })
    CompanyServiceTypeVo toCompanyServiceTypeVo(CompanyServiceType source);

    default List<CompanyServiceTypeVo> toCompanyServiceTypeVoList(List<CompanyServiceType> source){
        if (source == null) {
            return ListUtils.newEmptyList();
        }
        return source.stream().map(this::toCompanyServiceTypeVo).collect(Collectors.toList());
    }

    //-------------------------------- 以下为自定义类[输出对象] --------------------------------

    @ApiModel(value = "原始对象的扩展类")
    @Data
    class CompanyServiceTypeVo extends CompanyServiceType {
        
    }

    @ApiModel(value = "行级权限对象")
    @Data
    class CompanyServiceTypeRowAuthVo extends BaseRowAuthVo {

        //自定义其它行级权限


        //构造函数
        public CompanyServiceTypeRowAuthVo(CompanyServiceType entity){
            //当前操作用户ID
            String userId = AppUtils.getUserId();
        }
        
    }


    //-------------------------------- 以下为自定义类[输入对象] --------------------------------

    @ApiModel(value = "搜索VO")
    @Data
    class PageSearchVo {

    }

    @ApiModel(value = "添加和修改对象")
    @Data
    class SaveVo {

        @NotBlank(message = "数据ID不能为空", groups = {VdEdit.class})
        @ApiModelProperty(value = "数据ID")
        private String companyServiceTypeId;

        @NotBlank(message = "主键不能为空", groups = {VdAdd.class, VdEdit.class})
        @Size(min = 1, max = 36, message = "主键长度不能超过36", groups = {VdAdd.class, VdEdit.class})
        @ApiModelProperty(value = "主键")
        private String companyId;

        @NotBlank(message = "服务类型ID不能为空", groups = {VdAdd.class, VdEdit.class})
        @Size(min = 1, max = 36, message = "服务类型ID长度不能超过36", groups = {VdAdd.class, VdEdit.class})
        @ApiModelProperty(value = "服务类型ID")
        private String serviceTypeId;

        @ApiModelProperty(value = "审核id")
        private String checkId;

    }
    //-------------------------------- springboot验证标识 --------------------------------

}
